/*
 * 文件名：CompanyService.java
 * 版权：Copyright by www.huawei.com
 * 描述：
 * 修改人：Administrator
 * 修改时间：2016年4月6日
 * 跟踪单号：
 * 修改单号：
 * 修改内容：
 */

package com.zcsy.manage.service.company.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.zcsy.manage.model.base.Company;
import com.zcsy.manage.persistence.company.PropertyCompanyDao;
import com.zcsy.manage.service.company.IPropertyCompanyService;
import com.zcsy.manage.service.system.impl.SystemComService;

/**
 * @Title: OperationCompanyServiceImpl.java
 * @Package： com.zcsy.manage.service.base.impl 
 * @Description: 物业公司信息服务层实现类
 *
 * @author liuying 1075817474@qq.com
 * @Copyright: 2015 武汉中财数元信息技术有限公司 All rights reserved.
 * @date 2016年4月14日
 * @version 1.0
 * @see JDK1.7.0_75
 * @since
 */
@Service
public class PropertyCompanyServiceImpl extends SystemComService implements IPropertyCompanyService{

	@Autowired
	private PropertyCompanyDao companyDao;
	
	@Override
	public int insert(Company company) {
		return companyDao.insert(company);
	}

	@Override
	public int update(Company company) {
		Company oldCompany = companyDao.selectByPrimaryKey(company.getId());

		oldCompany.setCompanyName(company.getCompanyName());
		oldCompany.setCompanyAddr(company.getCompanyAddr());
		oldCompany.setPhone(company.getPhone());
		oldCompany.setIntroduces(company.getIntroduces());
		oldCompany.setSort(company.getSort());
		oldCompany.setLogo(company.getLogo());
		oldCompany.setUpdateTime(company.getUpdateTime());
		
		return companyDao.update(oldCompany);
	}

	@Override
	public int delete(String[] ids) {
		return companyDao.deleteByPrimaryKey(ids);
	}

	@Override
	public Company selectByPrimaryKey(String id) {
		return companyDao.selectByPrimaryKey(id);
	}

	@Override
	public List<Company> selectByKeyword(Company company) {
		return companyDao.selectByKeyword(company);
	}

	@Override
	public List<Company> getAllCompany() {
		return companyDao.getAllCompany();
	}

	@Override
	public int updateSort(Company record) {
		return companyDao.updateSort(record);
	}
	
}
